package com.newlink.building.utils

import android.content.Context
import android.widget.Toast
import androidx.annotation.StringRes

/**
 * @Author: Jake
 * @Date: 2023/2/8
 * @Description: wrapper toast
 */
object Module_Phone_ToastUtils {

    var toast: Toast? = null
    fun showTextToast(context: Context, msg: String) {
        if (toast == null) {
            toast = Toast.makeText(
                context, msg,
                Toast.LENGTH_SHORT
            )
        } else {
            toast?.setText(msg)
        }
        toast?.show()
    }

    fun showTextToast(context: Context, @StringRes msg: Int) {
        showTextToast(context, context.resources.getString(msg))
    }
}
